import { TenantItem } from "./models";
import req from "/@/api/req";

export enum Api {
  addTenantGroup = "api/system/tenantGroups/addTenantGroup",
  deleteTenantGroupByIds = "api/system/tenantGroups/deleteTenantGroupByIds",
  getTenantGroups = "api/system/tenantGroups/getTenantGroups",
  updateTenantGroup = "api/system/tenantGroups/updateTenantGroup",

  addTenant = "api/system/tenants/addTenant",
  initTenant = "api/system/tenants/initTenants",
  lockTenantById = "api/system/tenants/lockTenantById",
  tenantsPage = "api/system/tenants/page",
  updateTenant = "api/system/tenants/updateTenant",
  getTenantById = "api/system/tenants/getTenantsById",
  deleteTenantByIds = "api/system/tenants/deleteTenantByIds",
}

export function initTenant(tenantId: string) {
  return req.post<boolean>({
    data: {
      tenantId,
    },
    url: Api.initTenant,
  });
}

export function lockTenantById(tenantId: string, isLocked: boolean) {
  return req.post<TenantItem>({
    data: {
      tenantId,
      isLocked,
    },
    url: Api.lockTenantById,
  });
}
